/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.ref;

import java.util.Date;

/**
 * <p>Project: app2022 - User
 * <p>Powered by webrx On 2022-02-09 15:55:39
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */

@UserName
public class User {
    private int id;
    @UserName(name = "张三丰")
    private String name;
    private Date brith;
    private double money;

    public User(int id, String name, Date brith, double money) {
        this.id = id;
        this.name = name;
        this.brith = brith;
        this.money = money;
    }

    public User() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBrith() {
        return brith;
    }

    public void setBrith(Date brith) {
        this.brith = brith;
    }

    @UserName(name = "王五")
    public void show() {
        try {
            var m = this.getClass().getDeclaredMethod("show");
            if (m.isAnnotationPresent(UserName.class)) {
                System.out.println(m.getAnnotation(UserName.class).name());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }
}
